package com.cbs.android.component.weather.caiyun.sample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.cbs.android.component.log.L;
import com.cbs.android.component.weather.caiyun.Caiyun;
import com.cbs.android.component.weather.weatherinterface.WeatherHandler;
import com.cbs.android.component.weather.weatherinterface.WeatherInterface;
import com.cbs.android.component.weather.weatherinterface.entity.Forecast;
import com.google.gson.Gson;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getName();
    private WeatherInterface weatherInterface;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        weatherInterface = new Caiyun(this);
    }

    public void get(View view) {
        weatherInterface.getForecast(25.1552, 121.6544, new WeatherHandler() {
            @Override
            public void onForecast(Forecast forecast) {
                L.e("111", new Gson().toJson(forecast));
            }

            @Override
            public void onError(String message) {

            }
        });
    }
}
